package com.example.aplicacionfinal;


import android.content.Intent;
import android.os.Bundle;
import android.preference.PreferenceActivity;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.TextView;

public class MyPreferences extends PreferenceActivity {
	Button botonmenu;
	@Override 
	protected void onCreate(Bundle savedInstanceState){
		requestWindowFeature(Window.FEATURE_NO_TITLE);
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                WindowManager.LayoutParams.FLAG_FULLSCREEN);
		super.onCreate(savedInstanceState);
		   addPreferencesFromResource(R.xml.preferences);
	        setContentView(R.layout.activity_preferences);
	        botonmenu = (Button) this.findViewById(R.id.saveButton);
	        botonmenu.setOnClickListener(new View.OnClickListener() {
	    	    public void onClick(View view) {
	    	    	Intent miIntent = new Intent(MyPreferences.this, MenuActivity.class);
	    	    	startActivity(miIntent);
	    	    	MyPreferences.this.finish();
	    	    }
	    	});
	}
	/**
	 * Handler of the change difficulty button, changes the difficulty between easy, normal, hard
	 * @param v
	 */
	public void  change(View v){
		TextView difficulty = (TextView) this.findViewById(R.id.difficulty);
		if( difficulty.getText()=="Easy"){
			difficulty.setText("Normal");
		}else if(difficulty.getText()=="Normal"){
			difficulty.setText("Hard");
		}else{
			difficulty.setText("Easy");
		}
	}
}
